package com.example.gitproject.Boom;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

public class CardDrawGame {
    public static void main(String[] args) {
        int totalStudents = 53;
        Map<Integer, Integer> drawCounts = new HashMap<>();

        // 初始化每个学号的抽卡次数为0
        for (int i = 1; i <= totalStudents; i++) {
            drawCounts.put(i, 0);
        }

        Random random = new Random();
        // 模拟抽卡次数
        int totalDraws = 10;

        for (int i = 0; i < totalDraws; i++) {
            int chosenNumber = random.nextInt(totalStudents) + 1;
            drawCounts.put(chosenNumber, drawCounts.get(chosenNumber) + 1);
            System.out.println("第 " + (i + 1) + " 次抽到的学号是：" + chosenNumber);
        }

        System.out.println("\n抽卡结果统计：");
        for (Map.Entry<Integer, Integer> entry : drawCounts.entrySet()) {
            if (entry.getValue() > 0) {
                System.out.println("学号 " + entry.getKey() + " 被抽到的次数：" + entry.getValue());
            }
        }
    }
}